﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// Condition: Write a program that reads two arrays from the console and compares
//            element by element.


class CompareTwoArrays
{
    static void Main()
    {
        // 1. initialize first array

        Console.Write("Enter number of element in first integer array: ");
        int n1 = int.Parse(Console.ReadLine());
        int[] firstArray = new int[n1];
        Console.WriteLine("Enter elements of first array: ");
        for (int index = 0; index < n1; index++)
        {
            Console.Write("element[{0}]= ", index);
            firstArray[index] = int.Parse(Console.ReadLine());
        }
        Console.WriteLine();
        Console.WriteLine(new string('-', 20));
        Console.WriteLine();

        // 2. initialize second array

        Console.Write("Enter number of element in second integer array: ");
        int n2 = int.Parse(Console.ReadLine());
        int[] secondArray = new int[n2];
        Console.WriteLine("Enter elements of second array: ");
        for (int index = 0; index < n2; index++)
        {
            Console.Write("element[{0}]= ", index);
            secondArray[index] = int.Parse(Console.ReadLine());
        }
        Console.WriteLine();
        Console.WriteLine(new string('-', 20));
        Console.WriteLine();

        // 3. Compare two arrays and print the result
        bool areEqual = true;
        while (true)
        {
            if (n1 != n2)
            {
                areEqual = false;
                break;
            }
            else
            {
                for (int index = 0; index < n1; index++)
                {
                    if (firstArray[index] != secondArray[index])
                    {
                        areEqual = false;
                        break;
                    }
                }
            }
            break;
        }

        Console.WriteLine("Are two arrays equal: {0}", areEqual);
    }
}


